SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwlEmbargos
AS
SELECT        dbo.tb_Embargos.idEmbargo AS ID, dbo.tb_Embargos.Agente, dbo.tb_Embargos.Desde, dbo.tb_Embargos.Hasta, 
                         dbo.tb_TiposDeEmbargos.Descripcion AS TipoDeEmbargo, dbo.tb_FormulasDeDescuento.Descripcion AS FormulaDeDescuento, 
                         dbo.tb_Bancos.Descripcion AS Bancos, dbo.tb_Juzgados.Descripcion AS Juzgado, dbo.tb_Embargos.MontoTotal, dbo.tb_Embargos.MontoMensual
FROM            dbo.tb_Embargos INNER JOIN
                         dbo.tb_TiposDeEmbargos ON dbo.tb_Embargos.TipoEmbargo = dbo.tb_TiposDeEmbargos.idTipoEmbargo INNER JOIN
                         dbo.tb_Bancos ON dbo.tb_Embargos.Banco = dbo.tb_Bancos.idBanco INNER JOIN
                         dbo.tb_FormulasDeDescuento ON dbo.tb_Embargos.FormulaDeDescuento = dbo.tb_FormulasDeDescuento.IdFormula INNER JOIN
                         dbo.tb_Juzgados ON dbo.tb_Embargos.Juzgado = dbo.tb_Juzgados.idJuzgado
GO
GRANT SELECT ON  [dbo].[vwlEmbargos] TO [AdministracionSagenet]
GRANT SELECT ON  [dbo].[vwlEmbargos] TO [adm-sage]
GO
